#ifndef SOFT_MDIO_HPP
#define SOFT_MDIO_HPP

#include "MDIO.hpp"

namespace MDIO {

class SoftSTA : public STA {
public:
    class Adapter {
    public:
        enum Pin {
            Pin_MDC,
            Pin_MDIO,
        };

        enum MDIODirection {
            MDIODirection_TX,
            MDIODirection_RX,
        };
    public:
        virtual bool open() = 0;
        virtual bool close() = 0;
        virtual bool setPin(Pin pin,bool status) = 0;
        virtual bool getPin(Pin pin) = 0;
        virtual bool setMDIODirection(MDIODirection dir) = 0;
        virtual void delay() = 0;
    };
public:
    explicit SoftSTA(Adapter *adapter);
    virtual ~SoftSTA();

    virtual bool open();
    virtual bool close();

    virtual bool readRegister(uint8_t phy_ad,uint8_t reg_ad,uint16_t *buffer);
    virtual bool readRegister(uint8_t prt_ad,uint8_t dev_ad,uint16_t reg_ad,uint16_t *buffer);

    virtual bool writeRegister(uint8_t phy_ad,uint8_t reg_ad,uint16_t *buffer);
    virtual bool writeRegister(uint8_t prt_ad,uint8_t dev_ad,uint16_t reg_ad,uint16_t *buffer);

    virtual bool setVersion(Version version);
protected:
    Adapter *adapter;
};

}

#endif
